// component/uploadCropper/uploadCropper.js
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    // 图片上传
    onUploadAvatar() {
        var self = this;

        wx.chooseImage({
            count: 1,
            sizeType: ['original', 'compressed'],
            sourceType: ['album', 'camera'],
            success(res) {
                const src = res.tempFilePaths;
                wx.setStorageSync('hasSelectImage', true);
                wx.navigateTo({
                    url: '/component/upload/upload?src=' + src + '&imgType=0'
                })
            }
        })
    },

    uploadImg(imagePath) {
        var self = this;
        console.log('uploadImg-uploadImg=' + imagePath);
        self.setData({
            imagePath:imagePath
        })
    }

})